﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;

namespace ServidorCobro
{
    class RemObj : MarshalByRefObject, IRemObj
    {
        private Dictionary<string, IClientHandler> list =
           new Dictionary<string, IClientHandler>();

        public void EnviarMsg(string msg)
        {
            var data = msg.Split(';');

            //idCliente; recorrido.

            //Calculo precio
            int precio = 0;
            Int32.TryParse(data[1], out precio);
            double total = precio/10;          
            precio = Convert.ToInt32(Math.Ceiling(total));
            QueueServer q = new QueueServer();
            q.SendMessage("C08", data[0] + ";" + precio);
        }
        
        public void Registro(IClientHandler cli)
        {
            Console.WriteLine("Cliente " + cli.Nombre + " registrado");
            list.Add(cli.Nombre, cli);
        }

    }
}
